﻿using Dispatcher.Core.DingTalk.Models;
using Microsoft.AspNetCore.Mvc;
using MiniFox.Infrastructure;
using MiniFox.Platform.Applications.Web;
using MiniFox.Utility;

namespace Dispatcher.Core.DingTalk
{
    /// <summary>
    /// 
    /// </summary>
    public class DingTalkController : AuthorizedController<DingTalkEngineService>
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Response<DingTalkSendResponse>> SendAsync([FromBody] DingTalkSendRequest request)
        {
            var result = await this.Component.SendMessageAsync(request);
            return result.CreateResponse();
        }

        public Response UpdateStatus(DingTalkUpdateRequest request)
        {
            this.Component.UpdateStatus(request);

            return new();
        }
    }
}
